import { Shape, Edge } from '@antv/x6'

// 定义边
class TreeEdge extends Shape.Edge {
  isHidden() {
    const node = this.getTargetNode()
    return !node || !node.isVisible()
  }
}

TreeEdge.config({
  zIndex: 0,
  attrs: {
    line: {
      stroke: '#A2B1C3',
      strokeWidth: 2,
      targetMarker: {
        name: 'block',
        width: 12,
        height: 8,
      },
    },
  },
})

export {
  TreeEdge
}

Edge.registry.register('tree-edge', TreeEdge, true)
